//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Chart
{
    public class SurfaceSeries : Series
    {
        private DataSource cat;

        private NumericDataSource values;


        public DataSource Categories
        {
            get { return cat; }
            set { cat = value; notifyPropertyChanged("Categories");}
        }

        public NumericDataSource Values
        {
            get { return values; }
            set { values = value; notifyPropertyChanged("Values");}
        }


        internal override void ReadXmlCore(ReadContext context)
        {
            using (var c = context.Read("ser"))
            {
                ReadXmlBase(c);
                Categories = DataSource.ReadOptionalDataSource("cat", c);
                Values = NumericDataSource.ReadOptionalNumericDataSource("val", c);
                    //\\ c.ReadOptionalElementAs<INumericDataSource>("val");
                c.WarnIf("ext");
            }
        }

        internal override void WriteXmlCore(WriteContext context)
        {
            using (WriteContext c = context.Write("ser"))
            {
                WriteXmlBase(c);
                WriteOptionalNumericDataSource("cat", Categories, c);
                WriteOptionalNumericDataSource("val", Values, c); //\\ c.WriteOptionalElementAs(Values, "val");
                c.WarnIf("ext");
            }
        }
    }
}